From a2316486072403560dc15cb3d324cec5e54912a3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Mon, 19 Aug 2019 08:46:27 +0200 Subject: [PATCH] cssanimatedstyle: Avoid type check in loop We can just do the check once as source is not going to change within the loop. --- gtk/gtkcssanimatedstyle.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c index 21cc98c4fc..eb930c4a86 100644 --- a/gtk/gtkcssanimatedstyle.c +++ b/gtk/gtkcssanimatedstyle.c @@ -270,6 +270,7 @@ gtk_css_animated_style_create_css_transitions (GSList *animations, { TransitionInfo transitions[GTK_CSS_PROPERTY_N_PROPERTIES] = { { 0, } }; GtkCssValue *durations, *delays, *timing_functions; + gboolean source_is_animated; guint i; durations = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_DURATION); @@ -284,6 +285,7 @@ gtk_css_animated_style_create_css_transitions (GSList *animations, transition_infos_set (transitions, gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_PROPERTY)); + source_is_animated = GTK_IS_CSS_ANIMATED_STYLE (source); for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++) { GtkStyleAnimation *animation; @@ -298,14 +300,14 @@ gtk_css_animated_style_create_css_transitions (GSList *animations, if (duration + delay == 0.0) continue; - if (GTK_IS_CSS_ANIMATED_STYLE (source)) + if (source_is_animated) { - start = gtk_css_animated_style_get_intrinsic_value (GTK_CSS_ANIMATED_STYLE (source), i); + start = gtk_css_animated_style_get_intrinsic_value ((GtkCssAnimatedStyle *)source, i); end = gtk_css_style_get_value (base_style, i); if (_gtk_css_value_equal (start, end)) { - animation = gtk_css_animated_style_find_transition (GTK_CSS_ANIMATED_STYLE (source), i); + animation = gtk_css_animated_style_find_transition ((GtkCssAnimatedStyle *)source, i); if (animation) { animation = _gtk_style_animation_advance (animation, timestamp); -- 2.30.2